package 树;

import java.util.*;

public class Demo13{
    class Solution {
        public List<List<Integer>> zigzagLevelOrder(TreeNode root) {
            List<List<Integer>> lists = new ArrayList<>();
            if(root == null){
                return lists;
            }
            Queue<TreeNode> que = new LinkedList<>();
            que.offer(root);
            boolean flag = false;// true表示从左往右,反之从右往左
            while(!que.isEmpty()){
                List<Integer> list = new ArrayList<>();
                int levelCount = que.size();

                // 两级反转
                if(flag){
                    flag = false;
                }else{
                    flag = true;
                }

                while(levelCount > 0){
                    TreeNode node = que.poll();
                    list.add(node.val);
                    if(flag){
                        if(root.left != null) que.add(root.left);
                        if(root.right != null) que.add(root.right);
                    }else{
                        if(root.right != null) que.add(root.right);
                        if(root.left != null) que.add(root.left);
                    }
                    levelCount--;
                }
                lists.add(list);
            }
            return lists;
        }
    }
    /*
    *
    *
    * */
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str = scan.nextLine();
        char[] chars = str.toCharArray();
        int[] arr = new int[26];
        for(int i = 0; i<chars.length; i++){
            char c = chars[i];
            arr[c-'a']++;
        }

        int max = 0;
        char a;
        for(int i = 0; i<arr.length; i++){
            if(arr[i] > max){
                max = arr[i];
                a = (char)('a'+i);
            }
        }
        scan.close();
    }
}
